/*
 * Copyright (C) 2011 Nicola Bonzanni
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.vu.few.ibivu.jlemon.concepts;

public interface Path<A extends Arc & Comparable<A>> {
	/**
	 * Return the length of the path
	 * @return length of the path
	 */
	int length();
	/**
	 * Return whether the path is empty
	 * @return true whether the path is empty
	 */
	boolean empty();
	/**
	 * Reset the path to an empty one.
	 */
	void clear();
	/**
	 * Returns the n-th arc
	 * @param n TODO
	 * @return the n-th arc or null if n < 0 or n > lenght()-1
	 */
	A nth(int n);
	/**
	 * Initialize arc iterator to point to the n-th arc, , i.e. calling {@code next()} on the iterator returns the (n + 1)-th arc.
	 * @param n TODO
	 * @return an arc iterator that point to the n-th arc
	 */
	ItemIterator<A> nthIterator(int n);
	/**
	 * Return the first arc of the path.
	 * @return the first arc of the path
	 */
	A front();
	/**
	 * Add a new arc before the current path.
	 * @param arc the arc to add
	 */
	void addFront(A arc);
	/**
	 * Erase the first arc of the path.
	 */
	void eraseFront();
	/**
	 * Return the last arc of the path.
	 * @return the last arc of the path
	 */
	A back();
	/**
	 * Add a new arc behind the current path.
	 * @param arc the arc to add
	 */
	void addBack(A arc);
	/**
	 * Erase the last arc of the path.
	 */
	void eraseBack();
}
